<template>
  <div class="clubs-management">
    <!-- 页面头部 -->
    <div class="page-header">
      <div class="header-content">
        <div class="header-left">
          <h2 class="page-title">
            <el-icon class="title-icon"><OfficeBuilding /></el-icon>
            社团管理
          </h2>
          <p class="page-description">管理和监督所有社团的运营状态</p>
        </div>
        <div class="header-stats">
          <div class="stat-card">
            <div class="stat-number">{{ total }}</div>
            <div class="stat-label">总社团数</div>
          </div>
        </div>
      </div>
    </div>

    <!-- 搜索区域 -->
    <div class="search-container">
      <el-card class="search-card" shadow="never">
        <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" class="search-form">
          <el-form-item label="社团名称" prop="name">
            <el-input
              v-model="queryParams.name"
              placeholder="请输入社团名称"
              clearable
              style="width: 200px"
              @keyup.enter="handleQuery"
              prefix-icon="Search"
            />
          </el-form-item>
          <el-form-item label="分类" prop="categoryName">
            <el-select v-model="queryParams.categoryName" placeholder="请选择分类" clearable style="width: 200px">
              <el-option
                v-for="dict in clubs_tags"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="状态" prop="status">
            <el-select v-model="queryParams.status" placeholder="社团状态" clearable style="width: 200px">
              <el-option
                v-for="dict in club_status"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
            <el-button icon="Refresh" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
      </el-card>
    </div>

    <!-- 操作按钮区域 -->
    <div class="action-container">
      <el-card class="action-card" shadow="never">
        <div class="action-bar">
          <div class="action-left">
            <el-button
              type="primary"
              icon="Plus"
              @click="handleAdd"
              v-hasPermi="['system:clubs:add']"
              class="action-btn primary-btn"
            >
              <span>新增社团</span>
            </el-button>
            <el-button
              type="success"
              icon="Edit"
              :disabled="single"
              @click="handleUpdate"
              v-hasPermi="['system:clubs:edit']"
              class="action-btn"
            >
              <span>修改</span>
            </el-button>
            <el-button
              type="danger"
              icon="Delete"
              :disabled="multiple"
              @click="handleDelete"
              v-hasPermi="['system:clubs:remove']"
              class="action-btn"
            >
              <span>批量删除</span>
            </el-button>
            <el-button
              type="warning"
              icon="Download"
              @click="handleExport"
              v-hasPermi="['system:clubs:export']"
              class="action-btn"
            >
              <span>导出数据</span>
            </el-button>
          </div>
          <div class="action-right">
            <div class="toolbar-container">
              <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
            </div>
          </div>
        </div>
      </el-card>
    </div>

    <!-- 数据表格区域 -->
    <div class="table-container">
      <el-card class="table-card" shadow="never">
        <el-table 
          v-loading="loading" 
          :data="clubsList" 
          @selection-change="handleSelectionChange"
          class="clubs-table"
          :header-cell-style="{ background: '#f8f9fa', color: '#606266', fontWeight: '500' }"
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="社团信息" min-width="280" align="left">
            <template #default="scope">
              <div class="club-info">
                <div class="club-logo">
                  <el-image
                    v-if="scope.row.logo"
                    :src="getImageUrl(scope.row.logo)"
                    class="logo-image"
                    :preview-src-list="[getImageUrl(scope.row.logo)]"
                    fit="cover"
                  />
                  <el-avatar v-else :size="50" class="logo-avatar">
                    <el-icon><OfficeBuilding /></el-icon>
                  </el-avatar>
                </div>
                <div class="club-details">
                  <div class="club-name">{{ scope.row.name }}</div>
                  <div class="club-meta">
                    <el-tag size="small" class="category-tag">{{ scope.row.categoryName }}</el-tag>
                  </div>
                  <div class="club-description" v-if="scope.row.description">
                    {{ scope.row.description }}
                  </div>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="成员统计" align="center" width="120">
            <template #default="scope">
              <div class="member-stats">
                <div class="member-count">{{ scope.row.memberCount || 0 }}</div>
                <div class="member-label">成员</div>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="状态" align="center" width="120">
            <template #default="scope">
              <div class="status-column">
                <dict-tag :options="club_status" :value="scope.row.status" class="status-tag" />
              </div>
            </template>
          </el-table-column>
          <el-table-column label="时间信息" align="center" width="180">
            <template #default="scope">
              <div class="time-info">
                <div class="time-item">
                  <span class="time-label">创建:</span>
                  <span class="time-value">{{ parseTime(scope.row.createdAt, '{m}-{d}') }}</span>
                </div>
                <div class="time-item">
                  <span class="time-label">更新:</span>
                  <span class="time-value">{{ parseTime(scope.row.updatedAt, '{m}-{d}') }}</span>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="200" align="center" class-name="action-column">
            <template #default="scope">
              <div class="action-buttons">
                <el-button 
                  v-if="scope.row.userStatus==2&&scope.row.role!=0" 
                  link 
                  type="primary" 
                  icon="Edit" 
                  @click="handleUpdate(scope.row)" 
                  v-hasPermi="['system:clubs:edit']"
                  class="action-btn-small"
                >修改</el-button>
                <el-button 
                  link 
                  type="warning" 
                  icon="Check" 
                  @click="openAuditDialogBtn(scope.row)" 
                  v-hasPermi="['system:clubs:audit']"
                  class="action-btn-small"
                >审核</el-button>
                <el-button 
                  v-if="scope.row.userStatus==2" 
                  link 
                  type="success" 
                  icon="ChatDotRound" 
                  @click="handleChat(scope.row)"
                  class="action-btn-small"
                >群聊</el-button>
                <el-button 
                  v-if="scope.row.userStatus==2&&scope.row.role!=0" 
                  link 
                  type="danger" 
                  icon="Delete" 
                  @click="handleDelete(scope.row)" 
                  v-hasPermi="['system:clubs:remove']"
                  class="action-btn-small"
                >删除</el-button>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </el-card>
    </div>

    <pagination
      v-show="total > 0"
      :total="total"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改社团对话框 -->
    <el-dialog :title="title" v-model="open" width="500px" append-to-body>
      <el-form ref="clubsRef" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="社团Logo" prop="logo">
          <image-upload v-model="form.logo" :limit="1" :src="getImageUrl(form.logo)"/>
        </el-form-item>
        <el-form-item label="社团名称" prop="name">
          <el-input v-model="form.name" placeholder="请输入社团名称" />
        </el-form-item>
        <el-form-item label="社团描述" prop="description">
          <el-input v-model="form.description" type="textarea" placeholder="请输入社团描述" />
        </el-form-item>
        <el-form-item label="分类ID" prop="categoryName">
 <el-select v-model="form.categoryName" placeholder="请选择">
                        <el-option
                           v-for="dict in clubs_tags"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                        ></el-option>
                     </el-select>
        </el-form-item>
        <el-form-item label="现任负责人" prop="currentLeaderName">
          <el-select v-model="form.currentLeaderName" placeholder="请选择现任负责人" style="width: 100%">
            <el-option
              v-for="member in memberOptions"
              :key="member.userId"
              :label="member.userName"
              :value="member.userName"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="加入条件" prop="requirements">
          <el-input v-model="form.requirements" type="textarea" placeholder="请输入加入条件" />
        </el-form-item>
        <!-- <el-form-item label="社团状态" prop="status">
          <el-select v-model="form.status" placeholder="请选择状态" style="width: 100%">
            <el-option
              v-for="dict in club_status"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item> -->
        <el-form-item label="拒绝原因" prop="rejectReason" v-if="form.status == 2">
          <el-input v-model="form.rejectReason" type="textarea" placeholder="请输入拒绝原因" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
    <el-dialog v-model="auditDialogVisible" title="社团审核" width="400px">
      <el-form :model="auditForm" :rules="auditFormRules" ref="auditFormRef">
        <el-form-item label="审核结果" prop="status">
          <el-radio-group v-model="auditForm.status">
            <el-radio :label="1">通过</el-radio>
            <el-radio :label="2">不通过</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="拒绝原因" prop="remark" v-if="auditForm.status === 2">
          <el-input v-model="auditForm.remark" type="textarea" placeholder="请填写拒绝原因" />
        </el-form-item>
      </el-form>
      <template #footer>
        <el-button @click="auditDialogVisible = false">取消</el-button>
        <el-button type="primary" @click="submitAudit">确定</el-button>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="Clubs">
import { listClubs, getClubs, getClubBById,delClubs, addClubs, updateClubs, auditClub } from "@/api/system/clubs";
import { getMembersByClubId } from "@/api/system/members";
import ImageUpload from "@/components/ImageUpload";
import { OfficeBuilding, Search, Refresh, Plus, Edit, Delete, Download, Check, ChatDotRound, User, Calendar, Clock } from '@element-plus/icons-vue';

const { proxy } = getCurrentInstance();
// 修改3：更新字典名称以匹配状态选项
const { club_status ,clubs_tags,member_status} = proxy.useDict("club_status","clubs_tags","member_status");

const clubsList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const auditDialogVisible = ref(false);
const auditForm = reactive({
  clubId: null,
  status: 1,
  remark: ''
});
const auditFormRules = {
  status: [
    { required: true, message: '请选择审核结果', trigger: 'change' }
  ],
  remark: [
    { required: true, message: '请填写拒绝原因', trigger: 'blur',
      validator(rule, value, callback) {
        if (auditForm.status === 2 && !value) {
          callback(new Error('请填写拒绝原因'));
        } else {
          callback();
        }
      }
    }
  ]
};

const form = reactive({
  clubId: undefined,
  name: '',
  description: '',
  logo: '',
  categoryName: '',
  currentLeaderName: '',
  requirements: '',
  status: '',
  rejectReason: '',
  // 其它字段按需补充
});
const queryParams = reactive({
  pageNum: 1,
  pageSize: 10,
  name: '',
  categoryName: '',
  status: ''
});

const rules = {
  name: [{ required: true, message: "社团名称不能为空", trigger: "blur" }],
  categoryName: [{ required: true, message: "分类ID不能为空", trigger: "blur" }],
  status: [{ required: true, message: "状态不能为空", trigger: "blur" }],
  requirements: [{ required: true, message: "加入条件不能为空", trigger: "blur" }]
};

const memberOptions = ref([]); // 现任负责人下拉选项

/** 获取图片完整URL */
function getImageUrl(url) {
  if (!url) return '';
  if (url.startsWith('http://') || url.startsWith('https://')) {
    return url;
  }
  return import.meta.env.VITE_APP_BASE_API + url;
}

/** 查询社团列表 */
function getList() {
  loading.value = true;
  listClubs(queryParams).then(response => {
    clubsList.value = response.rows;
    total.value = response.total;
    loading.value = false;
  });
}
/** 取消按钮 */
function cancel() {
  open.value = false;
  reset();
}
/** 表单重置 */
function reset() {
  Object.assign(form, {
    clubId: undefined,
    name: '',
    description: '',
    logo: '',
    categoryName: '',
    founderId: undefined,
    currentLeaderName: '',
    memberCount: 0,
    requirements: '',
    status: '0',
    rejectReason: undefined
  });
  proxy.resetForm("clubsRef");
}
/** 搜索按钮操作 */
function handleQuery() {
  queryParams.pageNum = 1;
  getList();
}
/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm("queryRef");
  handleQuery();
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
  ids.value = selection.map(item => item.clubId);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
  Object.assign(form, {
    clubId: undefined,
    name: '',
    description: '',
    logo: '',
    categoryName: '',
    currentLeaderName: '',
    requirements: '',
    status: '',
    rejectReason: '',
    // 其它字段按需补充
  });
  open.value = true;
  title.value = "添加社团";
}
/** 修改按钮操作 */
function handleUpdate(row) {
  const clubIds = row.clubId || ids.value[0];
  Object.assign(form, {
    clubId: row.clubId,
    name: row.name || '',
    description: row.description || '',
    logo: row.logo || '',
    categoryName: row.categoryName || '',
    currentLeaderName: row.currentLeaderName || '',
    requirements: row.requirements || '',
    status: row.status || '',
    rejectReason: row.rejectReason || '',
    // 其它字段按需补充
  });
  // 加载社团成员列表
  if (clubIds) {
    // getMembersByClubId(clubIds).then(response => {
    //   memberOptions.value = response.data || [];
    // }).catch(() => {
    //   memberOptions.value = [];
    // });

    getClubBById(clubIds).then(response => {
       Object.assign(form, response.data)
        memberOptions.value = response.data.membersList || [];
    }).catch(() => {
      memberOptions.value = [];
    });


    
  }
  open.value = true;
  title.value = "修改社团";
}
/** 提交按钮 */
function submitForm() {
  proxy.$refs["clubsRef"].validate(valid => {
    if (valid) {
      if (form.clubId != undefined) {
        console.info(form)
        updateClubs(form).then(response => {
          proxy.$modal.msgSuccess("修改成功");
          open.value = false;
          getList();
        });
      } else {
        addClubs(form).then(response => {
          proxy.$modal.msgSuccess("新增成功");
          open.value = false;
          getList();
        });
      }
    }
  });
}
/** 删除按钮操作 */
function handleDelete(row) {
  const clubIds = row.clubId || ids.value;
  proxy.$modal.confirm('是否确认删除社团ID为"' + clubIds + '"的数据项？').then(function() {
    return delClubs(clubIds);
  }).then(() => {
    getList();
    proxy.$modal.msgSuccess("删除成功");
  }).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
  proxy.download("system/clubs/export", {
    ...queryParams
  }, `clubs_${new Date().getTime()}.xlsx`);
}

/** 群聊按钮操作 */
function handleChat(row) {
  const clubId = row.clubId;
  const clubName = row.name;
  proxy.$router.push({
    path: `/system/clubs/chat/${clubId}`,
    query: {
      clubName: clubName
    }
  });
}

function openAuditDialog(status) {
  auditForm.clubId = form.clubId;
  auditForm.status = status;
  auditForm.remark = '';
  auditDialogVisible.value = true;
}

function submitAudit() {
  proxy.$refs.auditFormRef.validate(valid => {
    if (!valid) return;
    auditClub(auditForm).then(res => {
      proxy.$message.success('审核成功');
      auditDialogVisible.value = false;
      open.value = false;
      getList();
    }).catch(() => {
      proxy.$message.error('审核失败');
    });
  });
}

function openAuditDialogBtn(row) {
  auditForm.clubId = row.clubId;
  auditForm.status = 1;
  auditForm.remark = '';
  auditDialogVisible.value = true;
}

getList();
</script>

<style lang="scss" scoped>
// 页面整体样式
.clubs-management {
  background: white;
  min-height: 100vh;
  padding: 20px;
}

// 头部样式
.page-header {
  background: white;
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid transparent;
  
  .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    
    .header-left {
      display: flex;
      align-items: center;
      gap: 16px;
      
      .page-title {
        display: flex;
        align-items: center;
        margin: 0;
        font-size: 28px;
        font-weight: 700;
        background: linear-gradient(135deg, #667eea, #764ba2);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        
        .title-icon {
          margin-right: 12px;
          font-size: 32px;
          color: #667eea;
        }
      }
      
      .page-description {
        margin: 4px 0 0 0;
        color: #666;
        font-size: 14px;
      }
    }
    
    .header-stats {
      display: flex;
      align-items: center;
      gap: 24px;
      
      .stat-card {
        text-align: center;
        padding: 16px 24px;
        background: linear-gradient(135deg, #667eea, #764ba2);
        border-radius: 12px;
        color: white;
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
        
        .stat-number {
          font-size: 24px;
          font-weight: 700;
          display: block;
        }
        
        .stat-label {
          font-size: 12px;
          margin-top: 4px;
          opacity: 0.9;
        }
      }
    }
  }
}

// 搜索区域样式
.search-container {
  margin-bottom: 24px;
  
  .search-card {
    background: white;
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid transparent;
  overflow: hidden;
    
    :deep(.el-card__body) {
      padding: 24px;
    }
    
    .search-form {
      :deep(.el-form-item) {
        margin-bottom: 16px;
        
        .el-form-item__label {
          font-weight: 600;
          color: #333;
        }
        
        .el-input {
          .el-input__wrapper {
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
            
            &:hover {
              box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
            }
            
            &.is-focus {
              box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
            }
          }
        }
        
        .el-select {
          width: 100%;
          
          .el-input__wrapper {
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
            
            &:hover {
              box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
            }
          }
        }
      }
      
      .el-button {
        border-radius: 8px;
        padding: 10px 20px;
        font-weight: 600;
        transition: all 0.3s ease;
        
        &.el-button--primary {
          background: linear-gradient(135deg, #667eea, #764ba2);
          border: none;
          
          &:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
          }
        }
        
        &.el-button--default {
          &:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
          }
        }
      }
    }
  }
}

// 操作按钮样式
.action-container {
  margin-bottom: 24px;
  
  .action-card {
    background: white;
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid transparent;
    
    :deep(.el-card__body) {
      padding: 20px 24px;
    }
    
    .action-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      
      .action-left {
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
        
        .action-btn {
          border-radius: 10px;
          padding: 12px 24px;
          font-weight: 600;
          transition: all 0.3s ease;
          display: flex;
          align-items: center;
          gap: 8px;
          
          &.primary-btn {
            background: linear-gradient(135deg, #667eea, #764ba2);
            border: none;
            color: white;
            
            &:hover {
              transform: translateY(-3px);
              box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
            }
          }
          
          &.el-button--success {
            background: linear-gradient(135deg, #4facfe, #00f2fe);
            border: none;
            color: white;
            
            &:hover {
              transform: translateY(-3px);
              box-shadow: 0 10px 30px rgba(79, 172, 254, 0.4);
            }
          }
          
          &.el-button--danger {
            background: linear-gradient(135deg, #fa709a, #fee140);
            border: none;
            color: white;
            
            &:hover {
              transform: translateY(-3px);
              box-shadow: 0 10px 30px rgba(250, 112, 154, 0.4);
            }
          }
          
          &.el-button--warning {
            background: linear-gradient(135deg, #a8edea, #fed6e3);
            border: none;
            color: #333;
            
            &:hover {
              transform: translateY(-3px);
              box-shadow: 0 10px 30px rgba(168, 237, 234, 0.4);
            }
          }
        }
      }
      
      .action-right {
        display: flex;
        align-items: center;
        
        // 工具栏容器样式
        .toolbar-container {
          display: flex;
          align-items: center;
          margin-left: 16px;
        }
      }
    }
  }
}

// 表格样式
.table-container {
  .table-card {
    background: white;
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid transparent;
    overflow: hidden;
    
    :deep(.el-card__body) {
      padding: 0;
    }
    
    .clubs-table {
      :deep(.el-table) {
        background: white;
        
        .el-table__header {
          th {
            background: linear-gradient(135deg, #f8f9ff, #e8f0ff);
            color: #333;
            font-weight: 700;
            border: none;
            padding: 16px 12px;
            
            .cell {
              display: flex;
              align-items: center;
              gap: 8px;
            }
          }
        }
        
        .el-table__body {
          tr {
            transition: all 0.3s ease;
            
            &:hover {
              background: rgba(102, 126, 234, 0.05);
              transform: scale(1.01);
            }
            
            td {
              border: none;
              padding: 16px 12px;
              
              .cell {
                display: flex;
                align-items: center;
                gap: 8px;
              }
            }
          }
        }
      }
      
      // 社团信息样式
      .club-info {
        display: flex;
        align-items: center;
        gap: 16px;
        
        .club-logo {
          .logo-image {
            width: 50px;
            height: 50px;
            border-radius: 8px;
            border: 2px solid transparent;
            object-fit: cover;
          }
          
          .logo-avatar {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
          }
        }
        
        .club-details {
          flex: 1;
          
          .club-name {
            font-weight: 600;
            color: #333;
            margin-bottom: 6px;
            font-size: 16px;
          }
          
          .club-meta {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 4px;
            
            .category-tag {
              background: linear-gradient(135deg, #667eea, #764ba2);
              color: white;
              border: none;
              border-radius: 12px;
              padding: 2px 8px;
              font-size: 12px;
            }
            
            .club-id {
              font-size: 12px;
              color: #999;
            }
          }
          
          .club-description {
            font-size: 13px;
            color: #666;
            max-width: 200px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
        }
      }
      
      // 成员统计样式
      .member-stats {
        text-align: center;
        
        .member-count {
          font-size: 24px;
          font-weight: bold;
          color: #667eea;
          margin-bottom: 4px;
        }
        
        .member-label {
          font-size: 12px;
          color: #999;
        }
      }
      
      // 状态样式
      .status-column {
        .status-tag {
          :deep(.el-tag) {
            border-radius: 20px;
            padding: 6px 12px;
            font-weight: 600;
            font-size: 12px;
          }
        }
      }
      
      // 时间信息样式
      .time-info {
        .time-item {
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-bottom: 4px;
          font-size: 12px;
          
          .time-label {
            color: #999;
          }
          
          .time-value {
            color: #666;
            font-weight: 500;
          }
        }
      }
      
      // 操作按钮样式
      .action-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: center;
        
        .action-btn-small {
          padding: 6px 12px;
          border-radius: 6px;
          font-size: 12px;
          font-weight: 600;
          transition: all 0.3s ease;
          
          &.el-button--primary {
            background: linear-gradient(135deg, #4facfe, #00f2fe);
            border: none;
            color: white;
            
            &:hover {
              transform: translateY(-2px);
              box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
            }
          }
          
          &.el-button--warning {
            background: linear-gradient(135deg, #a8edea, #fed6e3);
            border: none;
            color: #333;
            
            &:hover {
              transform: translateY(-2px);
              box-shadow: 0 6px 20px rgba(168, 237, 234, 0.4);
            }
          }
          
          &.el-button--success {
            background: linear-gradient(135deg, #84fab0, #8fd3f4);
            border: none;
            color: white;
            
            &:hover {
              transform: translateY(-2px);
              box-shadow: 0 6px 20px rgba(132, 250, 176, 0.4);
            }
          }
          
          &.el-button--danger {
            background: linear-gradient(135deg, #fa709a, #fee140);
            border: none;
            color: white;
            
            &:hover {
              transform: translateY(-2px);
              box-shadow: 0 6px 20px rgba(250, 112, 154, 0.4);
            }
          }
        }
      }
    }
  }
}

// 分页样式
:deep(.el-pagination) {
  margin-top: 20px;
  justify-content: center;
  
  .el-pager li {
    border-radius: 8px;
    margin: 0 4px;
    transition: all 0.3s ease;
    
    &.is-active {
      background: linear-gradient(135deg, #667eea, #764ba2);
      color: white;
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
    
    &:hover {
      transform: translateY(-1px);
    }
  }
  
  .btn-prev,
  .btn-next {
    border-radius: 8px;
    transition: all 0.3s ease;
    
    &:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
  }
}

// 响应式设计
@media (max-width: 768px) {
  .clubs-management {
    padding: 12px;
    
    .page-header {
      .header-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
        
        .header-stats {
          width: 100%;
          justify-content: center;
        }
      }
    }
    
    .action-container {
      .action-bar {
        flex-direction: column;
        gap: 16px;
        
        .action-left {
          width: 100%;
          justify-content: center;
        }
      }
    }
    
    .club-info {
      flex-direction: column;
      text-align: center;
      gap: 12px;
      
      .club-details {
        .club-meta {
          justify-content: center;
        }
      }
    }
    
    .action-buttons {
      flex-direction: column;
      
      .action-btn-small {
        width: 100%;
        justify-content: center;
      }
    }
  }
}
</style>